<template>
  <div>
    <el-form class="input-form"
      label-position="right"
      label-width="120px"
      ref="editForm"
      :rules="propRules"
      :disabled="propReadonly"
      :model="form"
    >
    <el-row :gutter="20">
      <el-col :span="12">
        <el-form-item label="医院名称" prop="name">
          <el-input v-model="form.name" />
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="对应MSCM的医院Key" prop="key">
          <el-input v-model="form.key" />
        </el-form-item>
      </el-col>
    </el-row>
    <el-row :gutter="20">
      <el-col :span="12">
        <el-form-item label="客户端Id" prop="clientId">
          <el-input v-model="form.clientId" />
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="连接密码" prop="clientSecret">
          <el-input v-model="form.clientSecret" />
        </el-form-item>
      </el-col>
    </el-row>
    <el-row :gutter="20">
      <el-col :span="12">
        <el-form-item label="token" prop="accessToken">
          <el-input v-model="form.accessToken" />
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="密码类型" prop="grantType">
          <el-input v-model="form.grantType" />
        </el-form-item>
      </el-col>
    </el-row>
    <el-row :gutter="20">
      <el-col :span="12">
        <el-form-item label="token_type" prop="tokenType">
          <el-input v-model="form.tokenType" />
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="url_token" prop="urlToken">
          <el-input v-model="form.urlToken" />
        </el-form-item>
      </el-col>
    </el-row>
    <el-row :gutter="20">
      <el-col :span="12">
        <el-form-item label="url_service" prop="urlService">
          <el-input v-model="form.urlService" />
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="" prop="creator">
          <el-input v-model="form.creator" />
        </el-form-item>
      </el-col>
    </el-row>
    <el-row :gutter="20">
      <el-col :span="12">
        <el-form-item label="" prop="gmtCreate">
          <el-date-picker v-model="form.gmtCreate" type="date" :format="dates.defaultDatePattern"  :picker-options="dates.pickerOptions.date" />
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="" prop="modifier">
          <el-input v-model="form.modifier" />
        </el-form-item>
      </el-col>
    </el-row>
    <el-row :gutter="20">
      <el-col :span="12">
        <el-form-item label="" prop="gmtModified">
          <el-date-picker v-model="form.gmtModified" type="date" :format="dates.defaultDatePattern"  :picker-options="dates.pickerOptions.date" />
        </el-form-item>
      </el-col>
      </el-row>
    </el-form>
  </div>
</template>

<script>

export default {
  data() {
    return {
      form: {},
      viewData: {}
    }
  },
  created() {
    this.$emit('event-register', {
      validate: (callback) => {
        this.$refs.editForm.validate(callback)
      },
      beforeSave: () => {
        this.$emit('data-callback', this.form)
        return true
      },
      afterMove: (formData, initData) => {
        this.form = global.utils.jsonClone(formData)
      },
      afterSave: () => {
        // 用作返回自动主键
        this.form[this.propPrimaryKey] = this.propViewFormData[this.propPrimaryKey]
      },
      beforeDelete: () => {
        return true
      },
      afterDelete: () => {
      },
      beforeFlow: (flowButtonKey) => {
        return true
      },
      afterFlow: (flowButtonKey) => {
      },
      beforeClose: () => {
        return true
      }
    })
  },
  props: {
    propParent: Object,
    propInitData: Object,
    propPrimaryKey: String,
    propDictionaries: Object,
    propCurrentRow: Object,
    propViewFormData: Object,
    propReadonly: Boolean,
    propStatus: String,
    propRules: Object
  },
  components: {
  },
  computed: {
  }
}
</script>

<style lang="scss" scoped>
  .container {
    width: 100%;
    height: 100%;
  }
</style>
